package com.acme.service.bank;

import com.acme.domain.account.Account;
import com.acme.domain.bank.Bank;
import com.acme.domain.bank.Client;
import com.acme.exceptions.ClientNotExistException;

public class BankConsoleService {

	public static void printNumberOfClients(Bank bank) {
		System.out.println(bank.getClientCount());
	}

	public static void printNumberOfOpenedAccounts(Bank bank) {
		System.out.println(BankReportService.getNumberOfOpenAccounts(bank));
	}

	public void printAccountsSortedByDeposit(Bank bank, boolean ascending) {
		for (Account account : BankReportService.getAccountsSortedByDeposit(bank, ascending)) {
			System.out.println(account);		
		}
	}

	public void printClientsAccounts(Bank bank) {
		for(Client client : bank.getClientsList()) {
			for (Account account : client.getAccountsList()) {
				System.out.println(account.toString());
			}
		}
	}
	
	static public void printBalance(Bank bank) throws ClientNotExistException {
		System.out.println(bank.toString());
	}
	
}
